home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / dvips / structures.h < prev    next >
C/C++ Source or Header  |  1990-01-27  |  5KB  |  156 lines

  1. /*
  2.  *   This is dvips, a freely redistributable PostScript driver
  3.  *   for dvi files.  It is (C) Copyright 1986-90 by Tomas Rokicki.
  4.  *   You may modify and use this program to your heart's content,
  5.  *   so long as you send modifications to Tomas Rokicki.  It can
  6.  *   be included in any distribution, commercial or otherwise, so
  7.  *   long as the banner string defined below is not modified (except
  8.  *   for the version number) and this banner is printed on program
  9.  *   invocation, or can be printed on program invocation with the -? option.
  10.  */
  11.  
  12. /*   This file is the header for dvips's global data structures. */
  13.  
  14. #define BANNER "This is dvips, version 5.01 (C) 1986-90 Radical Eye Software\n" 
  15. #include <stdio.h>
  16. #if defined(lint) && defined(sun)
  17. extern char *sprintf() ;
  18. #endif
  19. #include "paths.h"
  20. #include "debug.h"
  21. /*
  22.  *   Constants, used to increase or decrease the capacity of this program.
  23.  */
  24. #define STRINGSIZE (15000)  /* maximum number of strings in program */
  25. #define RASTERCHUNK (8192)  /* size of chunk of raster */
  26. #define MINCHUNK (256)      /* minimum size char to get own raster */
  27. #define STACKSIZE (100)     /* maximum stack size for dvi files */
  28. #define MAXFRAME (5)        /* maximum depth of virtual font recursion */
  29. /*
  30.  *   Other constants, which define printer-dependent stuff.
  31.  */
  32. #define SWMEM (180000)      /* available virtual memory in PostScript printer */
  33. #define DPI (actualdpi)     /* dots per inch */
  34. #define FONTCOST (2300)     /* overhead cost of each sw font */
  35. #define PSFONTCOST (11000)   /* overhead cost for PostScript fonts */
  36. #define CHARCOST (50)       /* overhead cost for each character */
  37. #define STRINGCOST (10)     /* the cost of a string */
  38. #define OVERCOST (30000)    /* cost of overhead */
  39. /*
  40.  *   Type declarations.  integer must be a 32-bit signed; shalfword must
  41.  *   be a sixteen-bit signed; halfword must be a sixteen-bit unsigned;
  42.  *   quarterword must be an eight-bit unsigned.
  43.  */
  44. typedef long integer;
  45. typedef char boolean;
  46. typedef double real;
  47. typedef short shalfword ;
  48. typedef unsigned short halfword ;
  49. typedef unsigned char quarterword ;
  50. typedef short Boolean ;
  51. /*
  52.  *   If the machine has a default integer size of 16 bits, and 32-bit
  53.  *   integers must be manipulated with %ld, set the macro SHORTINT.
  54.  */
  55. #ifdef XENIX
  56. #define SHORTINT
  57. #else
  58. #undef SHORTINT
  59. #endif
  60. /*
  61.  *   This is the structure definition for resident fonts.  We use
  62.  *   a small and simple hash table to handle these.  We don't need
  63.  *   a big hash table.
  64.  */
  65. #define RESHASHPRIME (23)
  66. struct resfont {
  67.    char *PSname ;
  68.    char *specialinstructions ;
  69.    struct resfont *next ;
  70. } ;
  71.  
  72. /*
  73.  *   A chardesc describes an individual character.  Before the fonts are
  74.  *   downloaded, the flags indicate that the character has already been used
  75.  *   with the following meanings:
  76.  */
  77. typedef struct {
  78.    integer TFMwidth ;
  79.    shalfword pixelwidth ;
  80.    quarterword *packptr ;
  81.    quarterword flags ;
  82. } chardesctype ;
  83. #define EXISTS (1)
  84. #define PREVPAGE (2)
  85. #define THISPAGE (4)
  86. #define TOOBIG (8) /* not used at the moment */
  87. #define REPACKED (16)
  88.  
  89. /*
  90.  *   A fontdesc describes a font.  The name and area point into the string pool.
  91.  */
  92. typedef struct tfd {
  93.    integer checksum, scaledsize, designsize, thinspace ;
  94.    halfword dpi ;
  95.    halfword psname ;
  96.    char loaded ;
  97.    chardesctype chardesc[256] ;
  98.    char *name, *area ;
  99.    struct resfont *resfont ;
  100.    struct tft *localfonts ;
  101.    struct tfd *next ;
  102. } fontdesctype ;
  103.  
  104. /*  A fontmap associates a fontdesc with a font number.
  105.  */
  106. typedef struct tft {
  107.    integer fontnum ;
  108.    fontdesctype *desc ;
  109.    struct tft *next ;
  110. } fontmaptype ;
  111.  
  112. /*   Virtual fonts require a `macro' capability that is implemented by
  113.  *   using a stack of `frames'. 
  114.  */
  115. typedef struct {
  116.    quarterword *curp, *curl ;
  117.    fontdesctype *curf ;
  118.    fontmaptype *ff ;
  119. } frametype ;
  120.  
  121. /*
  122.  *   The next type holds the font usage information in a 256-bit table;
  123.  *   there's a 1 for each character that was used in a section.
  124.  */
  125. typedef struct {
  126.    fontdesctype *fd ;
  127.    halfword bitmap[16] ;
  128. } charusetype ;
  129.  
  130. /*   Next we want to record the relevant data for a section.  A section is
  131.  *   a largest portion of the document whose font usage does not overflow
  132.  *   the capacity of the printer.  (If a single page does overflow the
  133.  *   capacity all by itself, it is made into its own section and a warning
  134.  *   message is printed; the page is still printed.)
  135.  *
  136.  *   The sections are in a linked list, built during the prescan phase and
  137.  *   processed in proper order (so that pages stack correctly on output) during
  138.  *   the second phase.
  139.  */
  140. typedef struct t {
  141.    integer bos ;
  142.    struct t *next ;
  143.    halfword numpages ;
  144. } sectiontype ;
  145.  
  146. /*
  147.  *   Sections are actually represented not by sectiontype but by a more
  148.  *   complex data structure of variable size, having the following layout:
  149.  *      sectiontype sect ;
  150.  *      charusetype charuse[numfonts] ;
  151.  *      fontdesctype *sentinel = NULL ;
  152.  *   (Here numfonts is the number of bitmap fonts currently defined.)
  153.  *    Since we can't declare this or take a sizeof it, we build it and
  154.  *   manipulate it ourselves (see the end of the prescan routine).
  155.  */
  156.